The following description includes information that may be useful in understanding the present invention. It is not an admission that any of the information provided herein is prior art or relevant to the presently claimed invention, or that any publication specifically or implicitly referenced is prior art.
In real-time operating systems (RTOSs), memory management is extremely important. An RTOS that runs on a computer system must be able to quickly access memory (e.g., to allocate/deallocate memory for processes). The memory is usually organized by the RTOS into pools. Each memory pool typically has fixed-size memory blocks, and memory blocks from one pool can differ in size from memory blocks of a second pool. It is crucial that the RTOS has strict control over managing the memory pools to ensure that the memory blocks are returned to their proper pool when they are deallocated, especially when the memory blocks are allocated to a complex application that has different processes in different layers (e.g., networking layers) accessing data in the same memory blocks. An undue burden is placed on the application developer to keep track of memory pools. If a block is released to the wrong pool, the computer system could be exposed to risk, and the system could crash or suffer memory corruption.
Ideally, a memory block could be released at any point during the running of an application (by any sub-processes within the application), regardless of its pool of origin, without requiring an application programmer to maintain pool origin information.
A great deal of effort has been directed to memory management functions within general purpose operating systems. For example, U.S. Pat. No. 8,429,354 to Kodaka titled “Fixed Length Memory Block Management Apparatus and Method for Enhancing Memory Usability and Processing Efficiency”, filed Jan. 23, 2009, describes an apparatus capable of providing fixed length memory blocks to various processors in a system where the processors share the memory. Unfortunately, such an approach has little value within a deeply embedded system with little resources.
Additional efforts have been applied toward managing memory pools within embedded systems. U.S. Pat. No. 6,718,451 to Lawton et al. titled “Utilizing Overhead in Fixed Length Memory Block Pools”, filed Jan. 31, 2002, describes managing fixed length memory block pools having many memory blocks. Lawton merely discloses returning a pointer to the memory block that preserves an overhead area within the block. Although useful when constructing chains of blocks, Lawton fails to provide insight into how to return of block to the proper pool.
Further progress is made by International patent application publication WO 2007/09758 to Kim et al. titled “Method and System for Efficiently Managing Dynamic Memory in Embedded System”, filed Feb. 23, 2007. Kim provides for managing different sized memory blocks by registering with hash tables. Such an approach for managing blocks is useful, but requires management overhead with respect to hash tables, which can be too slow for low-end embedded systems.
U.S. Pat. No. 7,827,373 to Kaakani et al. titled “System and Method for Managing a Short-Term Heap Memory”, filed Oct. 31, 2005, discloses a method of allocating and de-allocating memory blocks more rapidly by using a pointer that identifies a start location of unallocated memory. U.S. Pat. No. 7,587,566 to Ballantyne et al. titled “Realtime Memory Management via Locking Realtime Threads and Related Data Structures”, filed Sep. 21, 2004, discloses a method for minimizing memory access latency during real-time processing by enabling the creation of heaps. The heap supports allocating and freeing memory in a non-blocking fashion.
Other efforts made in this field are described in CN 1556475 issued to Zhong Xing, CN 103399825 issued to Zhao, U.S. Pat. No. 5,491,808 issued to Geist, Jr., and U.S. Pat. No. 8,626,993 issued to Vaishampayan et al. Unfortunately, the previously known efforts do not appear to disclose a specific mechanism of allocating and deallocating blocks in an efficient and reliable manner.
Thus, there is still a need for improved memory management technologies to better ensure memory integrity while maintaining access efficiency.